import request from '@/utils/request'
import moment from 'moment'
// 本周
// const startTime = moment(
//   moment().week(moment().week()).startOf('week').valueOf()
// ).format('YYYY-MM-DD+HH:mm:ss')
// const startTime1 = moment(
//   moment().week(moment().week()).startOf('week').valueOf()
// ).format('YYYY-MM-DD')
const nowTime = moment(moment().valueOf()).format('YYYY-MM-DD')
// const nowTime1 = moment(moment().valueOf()).format('YYYY-MM-DD+HH:mm:ss')
const start = moment().startOf('day').format('YYYY-MM-DD+HH:mm:ss')
const end = moment().endOf('day').format('YYYY-MM-DD+HH:mm:ss')
const nowMonth = moment(
  moment().month(moment().month()).startOf('month').valueOf()
).format('YYYY-MM-DD+HH:mm:ss')
const nowMonth2 = moment(
  moment().month(moment().month()).startOf('month').valueOf()
).format('YYYY-MM-DD')
// 本日销售量个数
export const dayorderCount = () => { return request.get(`/api/order-service/report/orderCount?start=${start}&end=${end}`) }
// 本月销售个数
export const monthorderCount = () => { return request.get(`/api/order-service/report/orderCount?start=${nowMonth}&end=${end}`) }
// 本月销售数目
export const monthorderAmount = () => { return request.get(`/api/order-service/report/orderAmount?start=${nowMonth}&end=${end}`) }
// 本日销售数目
export const dayorderAmount = () => { return request.get(`/api/order-service/report/orderAmount?start=${start}&end=${end}`) }
// 本月成交金额
export const monthtotalBill = () => { return request.get(`/api/order-service/report/totalBill?start=${nowMonth}&end=${end}`) }
// 本日成交金额
export const daytotalBill = () => { return request.get(`/api/order-service/report/totalBill?start=${start}&end=${end}`) }
// 获取合作商列表
export const list = () => { return request.get('/api/user-service/partner/search?pageIndex=1&pageSize=100000') }
// 获取table列表
export const tablelist = (data) => { return request.get(`/api/order-service/report/partnerCollect?pageIndex=${data.pageIndex}&pageSize=${data.pageSize}&start=${nowMonth2}&end=${nowTime}`) }
// 搜索列表
export const searchtablelist = (data) => {
  console.log(data)
  return request.get('/api/order-service/report/partnerCollect', {
    params: {
      ...data
    }
  })
}
export const searchtotalBill = (data) => { return request.get(`/api/order-service/report/totalBill?start=${data.start}+00:00:00&end=${data.end}+23:59:59`) }
export const searchorderAmount = (data) => { return request.get(`/api/order-service/report/orderAmount?start=${data.start}+00:00:00&end=${data.end}+23:59:59`) }
export const searorderCount = (data) => { return request.get(`/api/order-service/report/orderCount?start=${data.start}+00:00:00&end=${data.end}+23:59:59`) }
